<template>
  <div class="homeDiv">
    <div class="container">
      <el-row>
        <el-col :span="24">
          <div id="willesPlay">
            <div class="playHeader">
              <div class="videoName">Tara - 懂的那份感觉</div>
            </div>
            <div class="playContent" style="z-index: 1000">
              <video
                id="videoElement"
                width="100%"
                height="100%"
                autoplay="true"
                controls
              ></video>
            </div>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import flvjs from "flv.js";
export default {
  name: "LivePlay",
  data() {
    return {
      currentDate: new Date(),
      codeUrl: "",
      redirect: undefined,
      playRoomName: "",
      flvPlayer:null
    };
  },

  mounted() {
    if (flvjs.isSupported()) {
      var videoElement = document.getElementById("videoElement");
      this.flvPlayer = flvjs.createPlayer({
        type: "flv",
        url: "http://oneplustow.cn:8080/live/cc.flv",
        isLive: true,
        enableStashBuffer: true,
      });
      this.flvPlayer.attachMediaElement(videoElement);
      this.flvPlayer.load();
      this.flvPlayer.play();
    }
  },
  methods: {
    handerViewLive() {
      alert("观看直播");
    },
  },
};
</script>

<style rel="stylesheet/scss" lang="scss">
.homeDiv {
  background-color: #fafafa;
  color: black;
  cursor: default;
  font-family: pingfang sc, microsoft yahei, sans-serif;
  height: 100%;
  overflow: hidden;
  margin: 0;
  max-width: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  transition: background-color 0.25s;
  -webkit-user-select: none;
  user-select: none;
}
.container {
  padding-right: 15px;
  padding-left: 15px;
  margin-right: auto;
  margin-left: auto;
  width: 1170px;
}
#willesPlay {
  margin: 100px auto;
  box-shadow: 0px 0px 15px #333333;
  position: relative;
  z-index: 100;
}
#willesPlay .playHeader {
  width: 100%;
  height: 48px;
  background: url("../assets/image/playheader.jpg") repeat-x;
  border-radius: 5px 5px 0px 0px;
}
#willesPlay .playContent {
  position: relative;
  height: auto;
  overflow: hidden;
  background: #000;
  cursor: pointer;
}
#willesPlay .playHeader .videoName {
  font-size: 16px;
  width: 400px;
  height: 48px;
  line-height: 48px;
  text-align: center;
  margin: 0 auto;
  color: #7a7f82;
}
</style>
